import numpy as np
from sklearn.metrics import accuracy_score

# (分类)准确率,所有分类正确的百分比。
y_pred = [0, 2, 1, 3]
y_true = [0, 1, 2, 3]
print(accuracy_score(y_true, y_pred))



from sklearn.metrics import recall_score
y_true = [0, 1, 2, 0, 1, 2]
y_pred = [0, 2, 1, 0, 0, 1]
print(recall_score(y_true, y_pred, average='macro'))

print(recall_score(y_true, y_pred, average='micro'))

print(recall_score(y_true, y_pred, average='weighted'))

print(recall_score(y_true, y_pred, average=None))

